
{% extends "synapse/base.html" %}
{% block stylesheets %}
        <link rel="stylesheet" type="text/css" href="/media/css/jquery.autocomplete.css">
        <link rel="stylesheet" href="/media/css/superfish.css" type="text/css" media="projection, screen">

        {{ block.super }}
{% endblock %}

{% block js_libraries %}
        <script type="text/javascript" src="/media/js/jquery-1.2.1.js"></script>

        <script type="text/javascript" src="/media/js/jquery.bgiframe.js"></script>

        <script type="text/javascript" src="/media/js/jquery.dimensions.js"></script>

        <script type="text/javascript" src="/media/js/jquery.autocomplete.js"></script>
        <script type="text/javascript" src="/media/js/superfish.js"></script>


        <script type="text/javascript">
        $(document).ready(function() {

            function formatItem(row) {

                //var row = row.split("|");

                return row[0];

            }

            function formatResult(row) {

                return row[0];

            }

            $('#id_author').autocomplete('/ac/authors/',{matchContains: false, formatResult: formatResult, formatItem: formatItem, matchCase: false, selectFirst: false, multiple: true, multipleSeparator: '; ', autoFill: true, delay: 200, minChars: 3, scroll: false });

            $('#id_journal').autocomplete('/ac/sources/',{matchContains: true, formatResult: formatResult, formatItem: formatItem, matchCase: false, selectFirst: false, multiple: false, autoFill: true, scroll: false });

            function populateElement(selector, defvalue) {

                if($(selector).attr('value') == null) {

                    $(selector).attr('value', defvalue);

                }

              

                $(selector).focus(function() {

                    if($(selector).attr('value') == defvalue) {

                        $(selector).attr('value', '');

                    }

                });

                

                $(selector).blur(function() {

                    if($(selector).attr('value') == null || $(selector).attr('value') == "") {

                        $(selector).attr('value', defvalue);

                    }

                });

            }

            populateElement('#id_author', 'Last Name, First');
            $("ol.nav").superfish(
                { delay: 200 }
            );

            
        });

        </script>

{% endblock %}

{% block content %}

    <!-- START: announcements -->
   {% if announcement %}<div id="announcements"><div id="ann_title">{{ announcement.title }}<br><span id="ann_date">{{ announcement.pub_date|date:"M j Y h:i A" }}</span></div><p>{{ announcement.body|safe }}</p></div> {% endif %}
    <!-- END: announcements -->
    <!-- START: messages -->
    {% if msg %}<div><h2 id="message">{{ msg|safe }}</h2><br><br></div>{% endif %}
    <script src="http://syndic8.scopus.com/getMessage?registrationId=JBHCKEPCKDHKRCLHLBHKKBJEKHKEOEILKTJQQKIJLT"></script>

	<!-- START: searchForm -->

	<div id="searchForm">
	   <h2>Complete One or More Fields</h2>

			<form id="search_form" method="get" action="/documents/search/">
                <table>

                    <tr><th>{{ form.author.label_tag }}</th><td>{{ form.author }}<br><span class="subtle">{% autoescape off %}{{ form.author.help_text }}{% endautoescape %}</span></td>{% if form.author.errors %}<td>{{ form.author.errors }}</td>{% endif %}</tr>

                    <tr><th>{{ form.keywords.label_tag }}</th><td>{{ form.keywords }}</td>{% if form.keywords.errors %}<td>{{ form.keywords.errors }}</td>{% endif %}</tr>

                    <tr><th>{{ form.journal.label_tag }}</th><td>{{ form.journal }}<br><span class="subtle">{{ form.journal.help_text }}</span></td>{% if form.journal.errors %}<td>{{ form.journal.errors }}</td>{% endif %}</tr>

                    {% if show_dmt %}<tr><th>{{ form.dmt.label_tag }}</th><td>{{ form.dmt }}</td>{% if form.dmt.errors %}<td>{{ form.dmt.errors }}</td>{% endif %}</tr>{% endif %}

                    <tr><th>{{ form.year_start.label_tag }}</th><td>From {{ form.year_start }} To {{ form.year_end }}</td>{% if form.year_start.errors %} <td>{{ form.year_start.errors }} {% endif %}{% if form.year_end.errors %} {{ form.year_end.errors }}</td>{% endif %}</tr>

                    <tr><th>{{ form.doc_type.label_tag }}</th><td>{% autoescape off %}{{ form.doc_type }}{% endautoescape %}</td>{% if form.doc_type.errors %}<td>{{ form.doc_type.errors }}</td>{% endif %}</tr>

                </table>
				<div class="clearLeft">&nbsp;</div>
				<div class="clearLeft"><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="    Search    ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" value="    Clear    "></p><br></div>
			</form>

			{% if is_logged_in %}<p><a href="http://synapse.mskcc.org/bulkload/" title="Bulk Data Import Form">Bulk Data Import Form</a></p>{% endif %}

	</div>

	<!-- END: searchForm -->
{% endblock %}

